<template>
    <el-dialog title="分红结算区间" :visible.sync="show" width="70%" @close="$emit('update:visible', false)">
        <el-table :data="tableData" border>
            <el-table-column label="分红区间" :formatter="initinterval" prop="profitBegin" align="center">

            </el-table-column>
            <el-table-column label="利润分配" prop="profitProportion" align="center">
                <template slot-scope="scope">
                    {{scope.row.profitProportion}}{{infobase.dividendUnit==1?'%':'元'}}
                </template>
            </el-table-column>
            <el-table-column label="激励基数" prop="profitBase" align="center">
                <template slot-scope="scope">
                    {{scope.row.profitBase==1?'营收业绩':''}}
                </template>
            </el-table-column>
            <el-table-column label="业绩激励" prop="distributionProportion" align="center">
                <template slot-scope="scope">
                    {{scope.row.distributionProportion}}{{infobase.dividendUnit==1?'%':'元'}}
                </template>
            </el-table-column>
        </el-table>
        <template slot="footer">
            <el-button @click="show = false">关 闭</el-button>
        </template>
    </el-dialog>
</template>
<script>


    export default {
        components: {},
        data() {
            return {
                show: false,
            }
        },
        props: ["tableData", "visible", 'infobase'],
        watch: {
            visible(o, n) {
                this.show = o;
                console.log(this.tableData, this.infobase);
            }
        },
        methods: {
            initinterval(row) {
                let str = ''
                if (!row.profitBegin) {
                    str = '<' + row.profitEnd + (this.infobase.type === 1 ? '%' : '元')
                } else if (row.profitBegin && row.profitEnd) {
                    str = row.profitBegin + (this.infobase.type === 1 ? '%' : '元') + '(含) -' + row.profitEnd + (this.infobase.type === 1 ? '%' : '元') + '(不含）'
                } else if (!row.profitEnd) {
                    str = '≥' + row.profitBegin + (this.infobase.type === 1 ? '%' : '元')
                }
                return str
            },

        },

        created() {

        },
        destroyed() {

        },
        filters: {}
    }

</script>

<style lang="stylus" scoped>

</style>
